function B = isproperty(O, P)
  % Return true where P is a property of object O
    if ischar(P) || isnumeric(P)
        P = {P};
    end
    B = zeros(size(P));
    if ishandle(O)
        for i=1:length(P)
            B(i) = ~isempty(findprop(O, P{i}));
        end
    else
        try
            fldnames = fieldnames(O);
        catch me
            B = getReport(me);
        end
        for i=1:length(P)
            try
                B(i) = ismember(P{i}, fldnames);
            catch me
                continue
            end
        end
    end
